<template>
    <view style="height: 100%">
        <!-- pages/logisticsList/logisticsList.wxml -->
        <view class="header v-center">{{ logList.length }}个包裹已经发出</view>
        <view @tap="showLogistics" class="logistics" :data-item="item" v-for="(item, index) in logList" :key="index">
            <view class="title v-center between">
                <text>{{ item.Head.Express + '【' + item.Head.Fcode + '】' }}</text>
                <view class="nowrap">
                    <text class="dt">{{ item.Head.Fsenddate }}</text>
                    <image style="width: 32px; height: 32px" src="/static/file/images/new_right.png"></image>
                </view>
            </view>

            <view class="skuList flex wrap">
                <view class="skuItem" v-for="(sku, i) in item.Detail" :key="i">
                    <view class="sku_name algin">{{ sku.Fsummary }}</view>

                    <view class="item_pic algin">
                        <image :src="sku.Fimg"></image>
                    </view>

                    <view class="sku_num algin">数量：{{ sku.Fnum }}</view>
                </view>
            </view>
        </view>
        <floatIcon></floatIcon>
    </view>
</template>

<script>
import floatIcon from '@/component/floatIcon/floatIcon';
// pages/logisticsList/logisticsList.js
var util = require('../../utils/util.js');
var api = require('../../utils/prom.js'); 
export default {
    components: {
        floatIcon
    },
    data() {
        return {
            color: app.globalData.color,
            logList: [],
            code: '',
            i: '',

            sku: {
                Fsummary: '',
                Fimg: '',
                Fnum: ''
            }
        };
    },
    /**
     * 生命周期函数--监听页面加载
     */
    onLoad: function (options) {
        var that = this;
        that.code = options.code;
    },
    /**
     * 生命周期函数--监听页面显示
     */
    onShow: function () {
        this.logisticsList();
    },
    /**
     * 页面相关事件处理函数--监听用户下拉动作
     */
    onPullDownRefresh: function () {},
    /**
     * 用户点击右上角分享
     */
    onShareAppMessage: function () {
        return {
            title: app.globalData.shareinfo.title,
            imageUrl: app.globalData.shareinfo.img,
            desc: app.globalData.shareinfo.desc,
            path: 'pages/index/index?Fid=' + uni.getStorageSync('uid')
            //点击分享的图片进到哪一个页面
        };
    },
    methods: {
        //销售单物流列表查询
        logisticsList: function () {
            var that = this;
            var param = {
                token: uni.getStorageSync('token'),
                Fcode: that.code
            };
            api.request('SpSaleDelivery', 'get', param, function (res) {
                res.data.Rows.map(function (item) {
                    item.Head.Fsenddate = util.formatCTime(item.Head.Fsenddate);
                });
                console.log(res.data.Rows);
                that.logList = res.data.Rows;
            });
        }
		// ,

  //       showLogistics: function (e) {
  //           var that = this;
  //           var item = e.currentTarget.dataset.item;
  //           console.log(item);
  //           var com = item.Head.Express;
  //           var expresscode = item.Head.Fcode;
  //           var img = item.Detail[0].Fimg;
  //           uni.navigateTo({
  //               url: '/pages/logistics/logistics?com=' + com + '&expresscode=' + expresscode + '&img=' + escape(img)
  //           });
  //       }
    }
};
</script>
<style>
@import './logisticsList.css';
</style>
